package tmp;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class NameSorter1_ArrayList {

	private ArrayList<String> names = new ArrayList<String>();
	private ArrayList<Integer> ints = new ArrayList<Integer>();

	public void readNames() {
/*
		ints.add(1);
		int i = new Integer(3);
*/
		Scanner sc = new Scanner(System.in);
		System.out.println("Provide some Names: ");
		String name;
		names.clear();
		do {
			name = sc.nextLine();
			if (!name.isEmpty())
				names.add(name);
		} while (!name.isEmpty());
	}

	public void printNames() {
		for(String name: names) // for(i=1, names.length)
			System.out.println(name); //names[i]
	}

	public void sortNames() {
		Collections.sort(names);
	}

	public void start() {
		readNames();
		sortNames();
		printNames();
	}

	public static void main(String[] args) {
		new NameSorter1_ArrayList().start();

	}

}
